#include <stdio.h>
#include <math.h>
int main()
{
	freopen("test.in", "r", stdin);
	freopen("test.out", "w", stdout);
	int n = 0;
	scanf("%d", &n);
	for ( int i = 1; i <= n; i++ ) {
		int sum = 0;
		for ( int j = 1; j <= sqrt(i); j++ ) {
			if ( i % j != 0 ) {
				continue;
			}
			sum	+= j;
			int y = i / j;
			if ( j != y && y != i ) {
				sum	+= y;
			}
		}
		if ( sum == i ) {
			printf("%d\n", i);
		}
	}
	fclose(stdin);
	fclose(stdout);
	return 0;
}
